package edu.gdut.tiantian.service.Impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;

import edu.gdut.tiantian.dao.OrderDao;
import edu.gdut.tiantian.entity.Order;
import edu.gdut.tiantian.service.IOrderService;

@Service
public class OrderService implements IOrderService{
	
	@Autowired
	private OrderDao orderDao;
	@Override
	public List<Order> findByCondition(Map<String, String> condition, int pageNum) {
		PageHelper.startPage(pageNum, 5);
		return orderDao.findByCondition(condition);
	}

	@Override
	public void updateStatus(String orderId) {
		orderDao.updateStatus(orderId);
	}

	@Override
	public void addOrder(Order order,String userId,String orderId) {
		orderDao.addOrder(order,userId,orderId);
	}

	@Override
	public void withdraw(String orderId) {
		orderDao.withdraw(orderId);
	}

	@Override
	public Order findByOrderId(String orderId) {
		return orderDao.findByOrderId(orderId);
	}
}
